<include file="./Application/Admin/View/Public/htmlheader.html" />
<include file="./Application/Admin/View/Public/header.html" />
<include file="./Application/Admin/View/Public/left.html" />

<ol class="breadcrumb">
    <li><a href="/Admin">首页</a></li>
    <li class="active">功能列表</li>
</ol>

<div class="row">
    <div class="col-lg-12">
        <div class="table-responsive">
            <table class="table table-hover table-bordered">
                <tr class="success">
                    <th>功能名称</th>
                    <th>功能分类</th>
                    <th>功能地址</th>
                    <th>是否菜单栏</th>
                    <th>排序</th>
                    <th>创建时间</th>
                    <th>操作</th>
                </tr>
                <volist name="functions" id="vo">
                    <tr id="category{$vo['id']}" class="showChild" data="parentsCategoryId{$vo['id']}" style="cursor: pointer">
                        <td>{$vo.name}</td>
                        <td>
                            <if condition="$vo.categoryId eq 0">
                                顶级分类
                                <else />
                                {$vo.parentInfo.name}
                            </if>
                        </td>
                        <td>{$vo.url}</td>
                        <td>
                            <if condition="$vo.isMenu eq 0">否</if>
                            <if condition="$vo.isMenu eq 1">是</if>
                        </td>
                        <td>{$vo.sort}</td>
                        <td>{$vo.createTime}</td>
                        <td>
                            <a href="/Admin/UserGroupFunction/edit/id/{$vo.id}" class="btn btn-info btn-xs">编辑</a>
                            <if condition="$vo.child eq NULL">
                            <a href="/Admin/UserGroupFunction/del/id/{$vo.id}" onclick="return confirm('确定删除?');" class="btn btn-danger btn-xs">删除</a>
                            </if>
                        </td>
                    </tr>

                    <volist name="vo['child']" id="voo">
                        <tr style="display: none; background-color: #f9f6eb" class="parentsCategoryId{$voo['categoryId']}">
                            <td><span style="padding-left: 15px;">-</span>{$voo.name}</td>
                            <td>{$voo.parentInfo.name}</td>
                            <td>{$voo.url}</td>
                            <td>
                                <if condition="$voo.isMenu eq 0">否</if>
                                <if condition="$voo.isMenu eq 1">是</if>
                            </td>
                            <td>{$voo.sort}</td>
                            <td>{$voo.createTime}</td>
                            <td>
                                <if condition="$permission['edit'] eq TRUE">
                                <a href="/Admin/UserGroupFunction/edit/id/{$voo.id}" class="btn btn-info btn-xs">编辑</a>
                                </if>
                                <if condition="$permission['del'] eq TRUE">
                                <a href="/Admin/UserGroupFunction/del/id/{$voo.id}" onclick="return confirm('确定删除?');" class="btn btn-danger btn-xs">删除</a>
                                </if>
                            </td>
                        </tr>
                    </volist>
                </volist>
            </table>
            <div class="row">
                <div class="col-lg-3">
                    <if condition="$permission['add'] eq TRUE">
                        <button class="btn btn-primary" data-toggle="modal" data-target="#addFunction">添加功能</button>
                    </if>
                </div>
                <div class="col-lg-9 text-center">
                    <!--<nav>{$page}</nav>-->
                </div>
            </div>

        </div>
    </div>
</div>

<!--   添加功能 弹出层   -->
<div class="modal fade" id="addFunction" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                <h4 class="modal-title" id="myModalLabel">添加功能</h4>
            </div>
            <form action="__ROOT__/Admin/UserGroupFunction/add" method="post" enctype="multipart/form-data">
                <div class="modal-body">
                    <div class="row">
                        <div class="col-lg-3 text-right"><p><span class="red">*</span>功能名称：</p></div>
                        <div class="col-lg-9"><input type="text" name="name" class="form-control" /></div>
                    </div>
                    <br />
                    <div class="row">
                        <div class="col-lg-3 text-right"><p><span class="red">*</span>功能分类：</p></div>
                        <div class="col-lg-9">
                            <select name="categoryId" class="form-control">
                                <option value="0">顶级菜单</option>
                                <volist name="groupFunctions" id="vo">
                                    <option value="{$vo.id}">{$vo.name}</option>
                                </volist>
                            </select>
                        </div>
                    </div>
                    <br />
                    <div class="row">
                        <div class="col-lg-3 text-right"><p><span class="red">*</span>功能地址：</p></div>
                        <div class="col-lg-9"><input type="text" name="url" class="form-control" value="/" /></div>
                    </div>
                    <br />
                    <div class="row">
                        <div class="col-lg-3 text-right"><p><span class="red">*</span>是否菜单栏：</p></div>
                        <div class="col-lg-9">
                            <select name="isMenu" class="form-control">
                                <option value="0">否</option>
                                <option value="1" selected>是</option>
                            </select>
                        </div>
                    </div>
                    <br />
                    <div class="row">
                        <div class="col-lg-3 text-right"><p><span class="red">*</span>排序：</p></div>
                        <div class="col-lg-9"><input type="text" name="sort" class="form-control" /></div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                    <button type="submit" class="btn btn-primary">确认</button>
                </div>
            </form>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(".showChild").click(function(){
        var data = $(this).attr("data");
        $("."+data+"").toggle();
    })
</script>

<include file="./Application/Admin/View/Public/footer.html" />